package io.terminus.spzx.manager.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.terminus.spzx.manager.service.OrderInfoService;
import io.terminus.spzx.model.dto.order.OrderStatisticsDto;
import io.terminus.spzx.model.vo.common.Result;
import io.terminus.spzx.model.vo.common.ResultCodeEnum;
import io.terminus.spzx.model.vo.order.OrderStatisticsVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author lichunlong lcl253137@alibaba-inc.com
 * @Desc 订单管理Controller
 * @Date 2024-10-15
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "订单管理接口")
@RequestMapping(value = "/admin/order/orderInfo")
public class OrderInfoController {

    private final OrderInfoService orderInfoService;

    /**
     * 查询订单统计数据
     *
     * @param orderStatisticsDto 订单统计查询条件
     * @return 订单统计汇总数据
     */
    @GetMapping("/getOrderStatisticsData")
    public Result<OrderStatisticsVo> getOrderStatisticsData(OrderStatisticsDto orderStatisticsDto) {
        OrderStatisticsVo orderStatisticsVo = orderInfoService.getOrderStatisticsData(orderStatisticsDto);

        return Result.build(orderStatisticsVo, ResultCodeEnum.SUCCESS);
    }
}
